#define DEBUG
#include <cstdio>
#define MAXN 50000

using namespace std;

class Graph {
public:
  int n, m, ind[MAXN+1], to[2*MAXN-1], link[2*MAXN-1], stone[MAXN+1], f[MAXN+1], fa[MAXN+1];

  void addSide(int u, int v) {
    m++;
    to[m] = v;
    link[m] = ind[u];
    ind[u] = m;
  }

  void init(int o) {
    for (int i=ind[o]; i; i=link[i]) {
      if (to[i]!=fa[o]) {
	fa[to[i]] = o;
	init(to[i]);
	f[o] ^= f[to[i]]^stone[to[i]];
      }
    }
  }

  void change(int o, int x) {
    stone[o] = x;
    for (; o; o=fa[o]) {
      f[o] = 0;
      for (int i=ind[o]; i; i=link[i]) {
	if (to[i]!=fa[o]) {
	  f[o] ^= f[to[i]]^stone[to[i]];
	}
      }
    }
  }
};

int main() {
#ifdef DEBUG
  freopen("1.in", "r", stdin);
  freopen("1.out", "w", stdout);
#endif

  static Graph g;
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    scanf("%d", g.stone+i);
  }
  for (int i=1; i<n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g.addSide(u, v);
    g.addSide(v, u);
  }
  g.init(1);

  int t, cnt=0;
  scanf("%d", &t);
  for (int i=1; i<=t; i++) {
    int type, u, v, x, y;
    scanf("%d", &type);
    if (type==1) {
      scanf("%d", &v);
      v ^= cnt;
      printf(g.f[v] ? "Yes\n" : "No");
      cnt += (bool)g.f[v];
    } else if (type==2) {
      scanf("%d %d", &x, &y);
      x^=cnt, y^=cnt;
      g.change(x, y);
    } else if (type==3) {
      scanf("%d %d %d", &u, &v, &x);
      u^=cnt, v^=cnt, x^=cnt;
      g.addSide(u, v);
      g.addSide(v, u);
      g.fa[v] = u;
      g.change(v, x);
    }
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
